package com.taxigang.client.uibinder;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.taxigang.client.micro.TaxiGangCreator;
import com.taxigang.client.ui.map.MapView.PanelType;
import com.taxigang.client.uibinder.TaxiGangRoute.CreateMode;
import com.taxigang.client.uibinder.base.CreateStep;

public class CreateStep3 extends CreateStep {

	private static CreateStep3UiBinder uiBinder = GWT
			.create(CreateStep3UiBinder.class);

	interface CreateStep3UiBinder extends UiBinder<Widget, CreateStep3> {
	}

	public CreateStep3() {
		initWidget(uiBinder.createAndBindUi(this));
		bindUI();
		nowCallThisNumberLabel.setText(TaxiGangCreator.taxiGangConstants.nowCallAndOrderTaxi());
		okButton.setText(TaxiGangCreator.taxiGangConstants.iHaveCalledThisTaxi());
		headerLabel.setText(TaxiGangCreator.taxiGangConstants.step3());
	}

	@UiField Button backButton;
	
	@UiField Button okButton;
	@UiField Label nowCallThisNumberLabel;
	public static @UiField Label telNoLabel;
	@UiField
	Label headerLabel;

	private void bindUI() {
		backButton.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				PanelType panelType = PanelType.CREATE_STEP2A;
				if (taxiGangRoute.getCreateMode()!= CreateMode.CALL_A_TAXI){
					panelType = PanelType.CREATE_STEP2B;
				} 
				taxiGangRoute.show(panelType);				

			}
		});
		
		okButton.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				taxiGangRoute.show(PanelType.CREATE_STEP4);								
			}
		});
	}
	

}
